package com.itheima.web.controller;


import com.itheima.domain.db.UserFreezing;
import com.itheima.web.manager.FreezingManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
public class FreezingController {
    @Autowired
    private FreezingManager freezingManager;
//冻结用户
    @PostMapping("/manage/users/freeze")
        public String saveFreezing(@RequestBody UserFreezing userFreezing) {
            freezingManager.saveFreezing(userFreezing);
            return "操作成功";
    }

    //解冻用户
    @PostMapping("/manage/users/unfreeze")
    public String reasons(@RequestBody Map<String, Object> map) {
        Long userId =Long.valueOf (map.get("userId")+"");
        String reasonsForThawing = map.get("reasonsForThawing") + "";
        freezingManager.reasons(userId);
        return "操作成功";
    }
}
